import {defHttp} from '/@/utils/http/axios';

enum Api {
  list = '/annualkeywork/annualKeyWork/getAnnualKeyWorkList',
  ReportAction='/annualkeywork/annualKeyWork/reportaction',
  save='/annualkeywork/annualKeyWork/add',
  ApprovalTask='/annualkeywork/annualKeyWork/approval',
  getApprovalKeyWorkList='/annualkeywork/annualKeyWork/approvalKeyWorkList',
}
/**
 * 列表接口
 * @param params
 */
export const list = (params) =>
  defHttp.get({url: Api.list, params});
export const getApprovalKeyWorkList=(params)=>
  defHttp.get({url: Api.getApprovalKeyWorkList,params});
export const ApprovalTask = (params, handleSuccess) => {
  return defHttp.post({url: Api.ApprovalTask, params}).then(() => {
    handleSuccess();
  });
}
/**
 * 汇报任务
 * @param params
 */
export const ReportAction = (params, handleSuccess) => {
  return defHttp.post({url: Api.ReportAction, params}).then(() => {
    handleSuccess();
  });
}

/**
 * 保存或者更新
 * @param params
 */
export const saveOrUpdate = (params, isUpdate) => {
  let url = isUpdate ? Api.ReportAction : Api.save;
  return defHttp.post({url: url, params});
}
